From 4530ccf3fed5be49d09678c9d2586c207d3de51e Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Thu, 16 Oct 2008 11:33:05 +0900 Subject: [PATCH] [IA64] rename struct viosapic_rte in order to share VTD code. VTD code uses vioapic_redir_entry structure, This patch lets viosapci.h use the same structure name and some fields. That IA64 can use the same VTD code with ia32 Signed-off-by: Anthony xu --- xen/arch/ia64/vmx/viosapic.c | 18 +++++++++--------- xen/include/asm-ia64/viosapic.h | 2 +- xen/include/public/arch-ia64/hvm/save.h | 10 +++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/xen/arch/ia64/vmx/viosapic.c b/xen/arch/ia64/vmx/viosapic.c index a3cf1865fc..5a9ed27a71 100644 --- a/xen/arch/ia64/vmx/viosapic.c +++ b/xen/arch/ia64/vmx/viosapic.c @@ -46,9 +46,9 @@ static void viosapic_deliver(struct viosapic *viosapic, int irq) { - uint16_t dest = viosapic->redirtbl[irq].dest_id; - uint8_t delivery_mode = viosapic->redirtbl[irq].delivery_mode; - uint8_t vector = viosapic->redirtbl[irq].vector; + uint16_t dest = viosapic->redirtbl[irq].fields.dest_id; + uint8_t delivery_mode = viosapic->redirtbl[irq].fields.delivery_mode; + uint8_t vector = viosapic->redirtbl[irq].fields.vector; ASSERT(spin_is_locked(&viosapic->lock)); @@ -78,7 +78,7 @@ static int get_redir_num(struct viosapic *viosapic, int vector) ASSERT(spin_is_locked(&viosapic->lock)); for ( i = 0; i < VIOSAPIC_NUM_PINS; i++ ) - if ( viosapic->redirtbl[i].vector == vector ) + if ( viosapic->redirtbl[i].fields.vector == vector ) return i; return -1; @@ -91,7 +91,7 @@ static void service_iosapic(struct viosapic *viosapic) while ( (irq = iosapic_get_highest_irq(viosapic)) != -1 ) { - if ( viosapic->redirtbl[irq].trig_mode == SAPIC_LEVEL ) + if ( viosapic->redirtbl[irq].fields.trig_mode == SAPIC_LEVEL ) viosapic->isr |= (1UL << irq); viosapic_deliver(viosapic, irq); @@ -116,7 +116,7 @@ static void viosapic_update_EOI(struct viosapic *viosapic, int vector) if ( !test_and_clear_bit(redir_num, &viosapic->isr) ) { spin_unlock(&viosapic->lock); - if ( viosapic->redirtbl[redir_num].trig_mode == SAPIC_LEVEL ) + if ( viosapic->redirtbl[redir_num].fields.trig_mode == SAPIC_LEVEL ) gdprintk(XENLOG_WARNING, "redir %d not set for %d EOI\n", redir_num, vector); return; @@ -278,7 +278,7 @@ static void viosapic_reset(struct viosapic *viosapic) for ( i = 0; i < VIOSAPIC_NUM_PINS; i++ ) { - viosapic->redirtbl[i].mask = 0x1; + viosapic->redirtbl[i].fields.mask = 0x1; } spin_lock_init(&viosapic->lock); } @@ -292,11 +292,11 @@ void viosapic_set_irq(struct domain *d, int irq, int level) if ( (irq < 0) || (irq >= VIOSAPIC_NUM_PINS) ) goto out; - if ( viosapic->redirtbl[irq].mask ) + if ( viosapic->redirtbl[irq].fields.mask ) goto out; bit = 1UL << irq; - if ( viosapic->redirtbl[irq].trig_mode == SAPIC_LEVEL ) + if ( viosapic->redirtbl[irq].fields.trig_mode == SAPIC_LEVEL ) { if ( level ) viosapic->irr |= bit; diff --git a/xen/include/asm-ia64/viosapic.h b/xen/include/asm-ia64/viosapic.h index 869c284e4f..c334ea0c60 100644 --- a/xen/include/asm-ia64/viosapic.h +++ b/xen/include/asm-ia64/viosapic.h @@ -59,7 +59,7 @@ struct viosapic { spinlock_t lock; struct vcpu * lowest_vcpu; uint64_t base_address; - union viosapic_rte redirtbl[VIOSAPIC_NUM_PINS]; + union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS]; }; void viosapic_init(struct domain *d); diff --git a/xen/include/public/arch-ia64/hvm/save.h b/xen/include/public/arch-ia64/hvm/save.h index a2650b5916..c4c75946eb 100644 --- a/xen/include/public/arch-ia64/hvm/save.h +++ b/xen/include/public/arch-ia64/hvm/save.h @@ -106,7 +106,11 @@ DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime); */ #define VIOSAPIC_NUM_PINS 48 -union viosapic_rte +/* To share VT-d code which uses vioapic_redir_entry. + * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry + * instead of viosapic_redir_entry. + */ +union vioapic_redir_entry { uint64_t bits; struct { @@ -124,7 +128,7 @@ union viosapic_rte uint8_t reserved[3]; uint16_t dest_id; - }; + } fields; }; struct hvm_hw_ia64_viosapic { @@ -134,7 +138,7 @@ struct hvm_hw_ia64_viosapic { uint32_t pad; uint64_t lowest_vcpu_id; uint64_t base_address; - union viosapic_rte redirtbl[VIOSAPIC_NUM_PINS]; + union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS]; }; DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic); -- 2.30.2